#include "iTube.h"

#include "DownloadMgrDlg.h"
#include "fileversion.h"


BEGIN_EVENT_TABLE( DownloadMgrDlg, DldDialog )
	EVT_DOWNLOAD( DownloadMgrDlg::OnDownloadEvent )
END_EVENT_TABLE()

DownloadMgrDlg::DownloadMgrDlg( wxWindow* parent )
	: DldDialog( parent, -1 )
{

	progress = 0;
	}

void DownloadMgrDlg::OnDownloadEvent(libvdnEvent& event)
	{
	
	if (event.GetDownloadStatus() == libvdnEvent::DOWNLOAD_INPROGRESS)
		{
		
		
		
		//retrieve the percent of the file downloaded and 
		//display it on the progress gauge and as a number 
		progress = event.GetDownloadedPercent();	
		Progress_Text->SetLabel(wxString::Format(wxT("%d"),progress) + wxT("% has been downloaded."));

		DownloadProg->SetValue(progress);
		}
	}

void DownloadMgrDlg::Close()
	{
		this->Destroy();
	}


